package com.huawei.appmarket.service.distribution.authentication.bean;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.Signature;
import android.text.TextUtils;
import com.huawei.appgallery.foundation.store.bean.spilt.DeviceSpec;
import com.huawei.appgallery.foundation.store.bean.spilt.DeviceSpec.e;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import com.huawei.appmarket.service.distribution.deeplink.fulldetail.DisFullDetailActivityProtocol;
import com.huawei.appmarket.service.distribution.minidetail.MiniDetailActivityProtocol.Request;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import o.cfv;
import o.dmt;
import o.dnk;
import o.dnx;
import o.doa;
import o.dof;
import o.ContentManager;
import o.dxn;
import o.eux;

public class AgdSecurityVerificationRequest extends cfv {
    public static final String APIMETHOD = "client.agdSecurityVerification";
    private int advPlatform_;
    private String appid_;
    private int callWay_ = 2;
    private List<String> callerAppSigns_;
    private String callerPkgName_;
    private DeviceSpec deviceSpecParams_ = new e(ContentManager.getInstant().getContext()).ˎ(true).ॱ();
    private String pkgName_;
    private UriParams uriParams_;

    public static class CdcParams extends JsonBean {
        private String accessID_;
        private String channelId_;
        private int detailType_;
        private String extraParam_;
        private String id_;
        private String initParam_;
        private String s_;

        public CdcParams(String str, String str2, String str3, String str4, String str5, String str6, int i) {
            this.accessID_ = str;
            this.s_ = str2;
            this.id_ = str3;
            this.channelId_ = str4;
            this.detailType_ = i;
            this.extraParam_ = str5;
            this.initParam_ = str6;
        }
    }

    public static class UriParams extends JsonBean {
        private String advInfo_;
        private CdcParams cdcParams_;
        private String downloadParams_;
        private String referrer_;

        public UriParams(String str, CdcParams cdcParams) {
            this.referrer_ = str;
            this.cdcParams_ = cdcParams;
        }

        public UriParams(String str, String str2, String str3) {
            this.advInfo_ = str;
            this.downloadParams_ = str2;
            this.referrer_ = str3;
        }
    }

    private AgdSecurityVerificationRequest() {
    }

    public static AgdSecurityVerificationRequest ˏ(dxn o_dxn, Context context) {
        AgdSecurityVerificationRequest agdSecurityVerificationRequest = new AgdSecurityVerificationRequest();
        agdSecurityVerificationRequest.setMethod_(APIMETHOD);
        agdSecurityVerificationRequest.callerPkgName_ = o_dxn.ˏ();
        agdSecurityVerificationRequest.advPlatform_ = o_dxn.ˎ();
        agdSecurityVerificationRequest.callerAppSigns_ = ˎ(o_dxn.ˏ(), context);
        agdSecurityVerificationRequest.pkgName_ = o_dxn.ʼ();
        agdSecurityVerificationRequest.uriParams_ = new UriParams(o_dxn.ᐝ(), o_dxn.ʽ(), o_dxn.ʻ());
        agdSecurityVerificationRequest.ˏ(25);
        agdSecurityVerificationRequest.setStoreApi("clientApi");
        return agdSecurityVerificationRequest;
    }

    public static AgdSecurityVerificationRequest ˋ(Request request) {
        AgdSecurityVerificationRequest agdSecurityVerificationRequest = new AgdSecurityVerificationRequest();
        agdSecurityVerificationRequest.setMethod_(APIMETHOD);
        agdSecurityVerificationRequest.appid_ = request.ˎˎ();
        agdSecurityVerificationRequest.uriParams_ = new UriParams(ͺ(request.ॱˎ()), new CdcParams(request.ᐝ(), request.ˍ(), request.ˋˋ(), request.ˋᐝ(), request.ॱᐝ(), request.ᐝॱ(), 1));
        agdSecurityVerificationRequest.ˏ(25);
        agdSecurityVerificationRequest.setStoreApi("clientApi");
        return agdSecurityVerificationRequest;
    }

    public static AgdSecurityVerificationRequest ˏ(DisFullDetailActivityProtocol.Request request) {
        AgdSecurityVerificationRequest agdSecurityVerificationRequest = new AgdSecurityVerificationRequest();
        agdSecurityVerificationRequest.setMethod_(APIMETHOD);
        agdSecurityVerificationRequest.appid_ = request.ˊˊ();
        agdSecurityVerificationRequest.uriParams_ = new UriParams(ͺ(request.ॱˎ()), new CdcParams(request.ᐝ(), request.ˊᐝ(), request.ˉ(), request.ˊˋ(), request.ॱᐝ(), request.ᐝॱ(), 0));
        agdSecurityVerificationRequest.ˏ(25);
        agdSecurityVerificationRequest.setStoreApi("clientApi");
        return agdSecurityVerificationRequest;
    }

    public static String ͺ(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        return dof.ˊ((String) dmt.ˊ(str).get("referrer"));
    }

    public void ʽ(int i) {
        this.callWay_ = i;
    }

    public List<String> ʼ() {
        return this.callerAppSigns_;
    }

    public static List<String> ˎ(String str, Context context) {
        List arrayList = new ArrayList();
        if (!dof.ॱ(str)) {
            PackageInfo ˏ = dnx.ˏ(str, context);
            if (!(ˏ == null || ˏ.signatures == null)) {
                for (Signature toCharsString : ˏ.signatures) {
                    String ॱ = eux.ॱ(dnk.ˏ(doa.ˊ(toCharsString.toCharsString())));
                    if (!dof.ॱ(ॱ)) {
                        arrayList.add(ॱ.toLowerCase(Locale.getDefault()));
                    }
                }
            }
        }
        return arrayList;
    }
}
